<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet SYSTEM "lang://blogs">

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">	
	
	<xsl:include href="../../main.xsl" />
	<xsl:include href="../menu.xsl" />
	<xsl:include href="../../common/form.xsl" />
	
	<xsl:template match="/data">
		<html>
		
		<head>
			<title>
				<xsl:value-of select="$pageTitle" />
			</title>
			<xsl:call-template name="meta-head" />
			<link rel="stylesheet" href="{$baseURI}/css/blogs.css" type="text/css" media="all" />
			<link rel="stylesheet" href="{$baseURI}/css/forms.css" type="text/css" media="all" />
			<script type="text/javascript" src="{$baseURI}/js/blogs.js" />
			<script type="text/javascript" src="{$baseURI}/js/simpleEditor.js" />
			
			<xsl:comment>[if IE]&gt;&lt;link rel="stylesheet" href="<xsl:value-of select="$baseURI"/>/css/blogs-ie.css" type="text/css" media="all" /&gt;&lt;![endif]</xsl:comment>
		</head>
		<body>
			
			<xsl:call-template name="top-userbar" />

			<div id="header">
				<xsl:call-template name="logo" />

				<xsl:call-template name="menu" />
			</div>

			<div id="blocks">
				<div id="blocks_inner">
					<xsl:call-template name="default-blocks-top" />
				</div>
			</div>

			<div id="content">
				<div id="content_inner">
					<xsl:apply-templates select="response" />
				</div>
			</div>

			<xsl:call-template name="footer" />
		</body>
		</html>
	</xsl:template>
	
	<xsl:template match="response">
		
		<xsl:if test="$method = 'create_blog'">
			<h1>&labelNewBlog;</h1>
		</xsl:if>
		
		<xsl:if test="$method = 'edit_blog'">
			<h1>&labelEditBlog;</h1>
			<div id="small_menu">
				<a class="selected" href="{$baseURI}/blogs/edit_blog/{$formPrefix}">&labelInformation;</a>
				<a href="{$baseURI}/blogs/edit_blog_members/{$formPrefix}">&labelParties;</a>
			</div>
		</xsl:if>
		<form action="{$baseURI}/blogs/create_blog/save" method="post" enctype="multipart/form-data">
			<xsl:if test="$method = 'edit_blog'">
				<xsl:attribute name="action">
					<xsl:value-of select="concat ($baseURI, '/blogs/edit_blog/', $formPrefix, '/save')" />
				</xsl:attribute>
			</xsl:if>
			
			<xsl:for-each select="form/field">
				<xsl:choose>
					<xsl:when test="@name = 'alias' and $method = 'edit_blog'"></xsl:when>
					
					<xsl:otherwise>
						<xsl:apply-templates select="." />
					</xsl:otherwise>
				</xsl:choose>
			</xsl:for-each>
			<p>
				<input type="submit" value="&labelCreateBlog;">
					<xsl:if test="$method = 'edit_blog'">
						<xsl:attribute name="value">
							<xsl:text>&labelSaveBlog;</xsl:text>
						</xsl:attribute>
					</xsl:if>
				</input>		
			</p>
		</form>
	</xsl:template>
	
</xsl:stylesheet>